"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = __importDefault(require("express"));
const router_1 = __importDefault(require("./router"));
const log4js_1 = __importDefault(require("./utils/log4js"));
const mes_1 = __importDefault(require("./utils/mes"));
const timeout_1 = __importDefault(require("./utils/timeout"));
const compression_1 = __importDefault(require("compression"));
const cors_1 = __importDefault(require("./middleware/cors"));
const app = (0, express_1.default)();
app
    .use(cors_1.default)
    .use((0, compression_1.default)())
    .use(express_1.default.static('public'))
    .use(log4js_1.default.connectLogger(log4js_1.default.getLogger('HTTP'), {
    level: 'auto',
    format: ':method :url :status :response-time ms'
}))
    .use(express_1.default.json())
    .use(express_1.default.urlencoded({ extended: true }))
    .use('/api', timeout_1.default, router_1.default)
    .use(['/api', '/api/*'], (req, res) => {
    res.status(502).send(mes_1.default.failed(`/api${req.url} 接口地址不存在！`));
})
    .listen(3000, () => {
    log4js_1.default.getLogger('新新小朋友').trace('3000端口已监听');
});
